# Base image for HDS resource manager
FROM        docker.repo:5000/ppc64le/centos_base
MAINTAINER  Andy Zhang <zch@cn.ibm.com>
ENV         container=docker
ARG         INST_DIR=/var/setup
RUN         mkdir $INST_DIR
ENV         CATALINA_HOME /usr/local/tomcat
WORKDIR     $INST_DIR

ARG         FILESERVER=http://172.16.0.164:8080/base_image
ENV         INFORMIXDIR /opt/informix/
RUN         yum install -y pam java-1.7.0
ENV         LD_LIBRARY_PATH $INFORMIXDIR/lib:$INFORMIXDIR/lib/esql:\
$INFORMIXDIR/lib/cli:$INFORMIXDIR/lib/c++:$INFORMIXDIR/lib/client:$INFORMIXDIR/lib/dmi
ADD         $FILESERVER/clientsdk.tar clientsdk.tar
ADD         $FILESERVER/apache-tomcat-7.0.69.tar.gz tomcat.tgz
# Install client sdk for informix, and tomcat
RUN         mkdir clientsdk && tar -xvf clientsdk.tar -C clientsdk && cd clientsdk \ 
            && ./installclientsdk -i silent -DLICENSE_ACCEPTED=TRUE -DUSER_INSTALL_DIR=$INFORMIXDIR \
            && cd .. && mkdir -p "$CATALINA_HOME" \
            && tar -xvf tomcat.tgz --strip-components=1 -C $CATALINA_HOME \
            && rm -fr clientsdk.tar clientsdk/ *.tgz
ADD         rm.conf $CATALINA_HOME
ENV         CLOUDDB_RM_CONFIG $CATALINA_HOME/rm.conf
ADD         run_tomcat.sh  /entrypoint.sh
ADD         $FILESERVER/cdsrest.war $CATALINA_HOME/webapps/
WORKDIR     $CATALINA_HOME

EXPOSE      8080
VOLUME      /usr/local/tomcat/logs
CMD         ["/entrypoint.sh"]
